package com.xin.di.uav.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xin.di.uav.po.OrderCommodity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 订单商品关联表 Mapper 接口
 * </p>
 *
 * @author LTQ
 * @since 2023-12-12
 */
@Mapper
public interface OrderCommodityMapper extends BaseMapper<OrderCommodity> {

    @Select({"<script>",
            "select id, create_time, update_time,`value`, value2, value3, value4, value5, order_sn, commodity_id, cnt, price, name, images,\n" +
                    "                             introduction from order_commodity where order_sn in ",
            "       <foreach item=\"id\" collection=\"ids\" open=\"(\" separator=\",\" close=\")\">\n" +
                    "            #{id}\n" +
                    "        </foreach>" +
                    "</script>"})
    List<OrderCommodity> selectById(@Param("ids") List<String> ids);


    @Select({"<script>",
            "select id, create_time, update_time, order_sn, commodity_id, spe_id, cnt, price, name, images,\n" +
                    "                             introduction, value, value2, value3, value4, value5 from order_commodity where order_sn =#{orderSn} " +
                    "</script>"})
    List<OrderCommodity> selectByOrderSn(@Param("orderSn") String orderSn);

}
